#pragma once

#include <iostream>
#include <stdexcept>

#include<GLTools.h>
#include<GLMatrixStack.h>
#include<GLGeometryTransform.h>
#include<GLFrustum.h>
#include<StopWatch.h>
#include"Controls.h"
#include"PhysicalObject.h"
#include"Launcher.h"
#include "Camera.h"
// Keiths Camera class
#include"Camerak.h"
#include "overlay.h"
#include "skybox.h"
#include"XTarget.h"

using namespace std;

class Game
{
private:
	//Other
	CStopWatch				updater;				//	CStopWatch - Does exactly what it says on the tin.
	GLMatrixStack			PMStack;				//	GLMatrixStack - allows functionality similar to old style openGL (i.e. pushMatrix();)
	GLFrustum				viewFrustum;			//	Allows simple creation and manipulation of a projection matrix.
	GLMatrixStack			MVMStack;				//	GLMatrixStack - allows functionality similar to old style openGL (i.e. pushMatrix();)
	GLGeometryTransform		geoTrans;				//	Nice Container for passing the two matrix Stacks around.
	Controls				*input;					//	Pointer to keyboard handler
	GLuint					textures[5];			//	texture. for testing.
	Camera					*theCam;				//	Pointer to Camera object.
	//Camerak*				 testCamera;
	PhysicalObject			*bullet;					//	Pointer to physical object (testing);
	PhysicalObject			*cube;
	XTarget					*myPO2;
	PhysicalObject			*myPO2Frame;
	skybox					*theSky;				//	Pointer to skybox object (testing rendering);
	float					timescale;				//	Global timescale multiplier.
	bool					collided,fired;
	GLuint					overlays[3];
	overlay					*crosshair;
	overlay					*info;

	Vector3f				initialForce;
public:
	//Constructor
	Game(int argc, char* argv[]);
	
	//Simple Init
	void gInit();
	//Update Function
	void gUpdate();
	
	//GLUT Callbacks
	void gResize(int width, int height);
	void gKeysUp(unsigned char key, int x, int y);
	void gKeysDn(unsigned char key, int x, int y);
	void gDisplay();
	void gMouseBtn(int button, int state, int x, int y);
	void gMouseMve(int x, int y);
	void resetBullet();
	//Into glut loop
	void gRun();

	//Destroyer of Worlds.
	~Game(void);

};

